package com.relytosoft.mizar.media.camera.services.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.relytosoft.dubhe.common.core.base.page.PageQuery;
import com.relytosoft.dubhe.common.core.object.ResponseResult;
import com.relytosoft.dubhe.common.core.utils.CommonUtils;
import com.relytosoft.dubhe.common.log.annotation.OpLog;
import com.relytosoft.dubhe.common.log.enums.OpTypeEnum;
import com.relytosoft.mizar.media.camera.api.pojo.dto.MultimediaDto;
import com.relytosoft.mizar.media.camera.api.pojo.vo.MultimediaVo;
import com.relytosoft.mizar.media.camera.services.service.MultimediaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author wss
 * @version 1.0
 * @date 2022/6/8 10:52
 */
@Api(tags = {"多媒体库"})
@RestController
@RequestMapping("multimedia")
public class MultimediaController {

    @Autowired
    private MultimediaService multimediaService;

    @SaCheckPermission("multimedia:list")
    @OpLog(msg = "多媒体列表", opType = OpTypeEnum.SELECT)
    @ApiOperation("查询")
    @GetMapping("/pageList")
    public ResponseResult<Map<String, Object>> list(MultimediaDto multimediaDto, PageQuery pageQuery) {
        IPage<MultimediaVo> voPage = multimediaService.pageList(multimediaDto, pageQuery);
        return ResponseResult.ok(CommonUtils.getPageData(voPage));
    }
}
